<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('logs', function (Blueprint $table) {
            $table->id()->comment('主键id');
            $table->string('browser', 100)->comment('访问浏览器');
            $table->string('operator', 100)->comment('操作人');
            $table->string('ip', 100)->comment('ip地址');
            $table->string('region', 150)->comment('地区');
            $table->string('os', 150)->comment('操作系统');
            $table->string('requestUri', 150)->comment('请求路由');
            $table->string('method', 50)->comment('请求类型');
            $table->integer('executionTime')->comment('执行时间(ms)');
            $table->timestamp('createTime')->nullable()->comment('创建时间（秒级时间戳）');
            $table->timestamp('updateTime')->nullable()->comment('更新时间（秒级时间戳）');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('logs');
    }
};
